<!--
 * @Description: 会议操作
 * @Author: wind-lc
 * @version: 1.0
 * @Date: 2021-08-25 10:29:15
 * @LastEditTime: 2021-08-30 10:01:44
 * @FilePath: \cscec-pms-admin\src\views\design\deepDesign\outcomeMeeting\operation.vue
-->
<template>
  <base-breadcrumb
    :breadcrumb="!isAudit"
    class="flexMemberInfo-container"
    :title="title"
  >
    <MeetingOperation
      :form="form"
      :meeting-type="'5'"
      :form-option="formOption"
      :rules="rules"
      :page-type="pageType"
      :file-option="fileOption"
    >
      <template slot="signNum">
        <div class="outcome-meeting-operation-btn">
          <BaseInput
            v-model="form.signNum"
            disabled
          />
          <a-button
            type="primary"
            @click="signInVsible = true"
          >
            查看签到
          </a-button>
          <ConferenceScreen
            v-if="pageType !== 'view'"
            :id="id"
            :meeting-screen="training.meetingScreen"
          />
        </div>
      </template>
    </MeetingOperation>
    <!-- 查看签到模态框 -->
    <SeeSign
      :id="id"
      :visible="signInVsible"
      :is-new="true"
      @cancel="signInVsible = false"
      @confirm="signInVsible = false"
    />
    <!-- 查看签到模态框 -->
  </base-breadcrumb>
</template>
<script>
import MeetingOperation from '@/components/Meeting/MeetingOperation'
import SeeSign from '@/components/seeSign'
import ConferenceScreen from '@/components/ConferenceScreen'
import training from '@/api/design/training'
export default {
  name: 'Operation',
  props: {
    isAudit: {
      // 是否作为审批详情
      type: Boolean,
      default: false
    }
  },
  components: {
    MeetingOperation,
    SeeSign,
    ConferenceScreen
  },
  data() {
    return {
      // 页面名称
      pageName: {
        detail: '会议详情',
        enter: '进入会议',
        view: '查看会议'
      },
      // 接口
      training,
      //表单
      form: {
        branchComName: '',
        projectName: '',
        meetingName: this.$route.query.meetingName,
        speakerId: '',
        meetingPlace: '',
        deepenResultsList: '',
        meetingTime: '',
        createUser: '',
        createTime: '',
        signNum: '',
        meetingSummary: '',
        viewName: ''
      },
      // 签到id
      id: this.$route.query.id,
      // 签到模态框显示隐藏
      signInVsible: false,
      // 文件配置
      fileOption: {
        // 处理操作的模式：'add'模式下，删除操作会调用文件删除接口，'edit'模式只会在表格中移除删除数据，不会调用接口
        mode: 'add',
        // 上传文件的业务编码
        businessCode: 'DESIGN01',
        // 是否需要分页
        needPage: false,
        // 初始化文件列表
        fileList: []
      }
    }
  },
  computed: {
    // 页面类型
    pageType() {
      return this.isAudit ? 'view' : this.$route.query.pageType
    },
    // 标题
    title() {
      return this.pageName[this.pageType]
    },
    // 表单配置
    formOption() {
      return [
        {
          label: '所属单位',
          keyName: 'viewName',
          type: 'BaseInput',
          disabled: true,
          span: 16
        },
        // {
        //   label: '项目名称',
        //   keyName: 'projectName',
        //   type: 'BaseInput',
        //   disabled: true
        // },
        {
          label: '会议名称',
          keyName: 'meetingName',
          type: 'BaseInput',
          disabled: true
        },
        {
          label: '主持人',
          keyName: 'speaker',
          type: 'BaseInput',
          disabled: true
        },
        {
          label: '会议地点',
          keyName: 'meetingPlace',
          type: 'BaseInput',
          disabled: true
        },
        {
          label: '深化设计成果',
          keyName: 'deepenResultsName',
          type: 'BaseInput',
          disabled: true
        },
        {
          label: '召开时间',
          keyName: 'meetingTime',
          type: 'BaseInput',
          disabled: true
        },
        {
          label: '记录人',
          keyName: 'createUser',
          type: 'BaseInput',
          disabled: true
        },
        {
          label: '记录时间',
          keyName: 'createTime',
          type: 'BaseInput',
          disabled: true
        },
        {
          label: '参会人员',
          keyName: 'signNum',
          slot: true
        },
        {
          label: '会议纪要',
          keyName: 'meetingSummary',
          type: 'BaseTextarea',
          autoSize: { minRows: 20, maxRows: 25 },
          attrs: {
            maxLength: 30000
          },
          rules: [{ required: true, message: '请输入', trigger: 'change' }],
          disabled: this.pageType !== 'enter',
          span: 24
        }
      ]
    },
    // 校验
    rules() {
      const obj = {}
      this.formOption.map((item) => {
        if (item.rules) {
          obj[item.keyName] = item.rules
        }
      })
      return obj
    }
  }
}
</script>
<style lang="less" scoped>
.outcome-meeting-operation-btn {
  display: flex;
  align-items: center;
  .BaseInput-container {
    flex: 1;
  }
  .ant-btn {
    height: 28px;
    margin-left: 10px;
  }
}
</style>
